#!/usr/bin/env python

import time
from ats.sesh import sessionmanager
import memcache


# -----------------------------------------------------------------------------
# Fake a request 
# -----------------------------------------------------------------------------
class Request:
	def __init__(self):
		self.unparsed_uri = "/some/uri"
		self.headers_in = {
			"Host": "some cool host",
			"User-Agent": "some cool useragent",
			"Referer": "check me I am your referer"}
		self.headers_out = {}

# -----------------------------------------------------------------------------
# Benchmark the sesh manager's performance 
# -----------------------------------------------------------------------------
def testme():
	req = Request()
	t1 = time.time()
	for x in xrange(1000):
		sessionmanager.persist_session(sessionmanager.get_session(req))
	t2 = time.time()
	print "%f" % (t2 - t1)
	

if __name__ == "__main__":
	testme()
